<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<head>
 	<meta http-equiv="Cache-Control" content="no-cache"/>
	<title> Web rezervacije</title>
</head>

<f:view>
	<h1>Prijavljen korisnik: <h:outputText value="#{users.user.username}" /> </h1>
	
	<ui:param name="flight" value="#{flights.flight}" />
	
	<h3>Let <h:outputText value="#{flight.idLeta}" />
	, od <h:outputText value="#{flight.polaziAerodrom}" />
	, do <h:outputText value="#{flight.odrediste}" />
	, vreme polaska: <h:outputText value="#{flight.vremePolaskaString}" />
	, vreme dolaska: <h:outputText value="#{flight.vremeDolaskaString}" /></h3>
	
	
	<table border="1" width="60%">
	<tr bgcolor="lightgrey"><th width="10%">Redni broj</th><th width="75%">Putnik</th><th width="75%">Otkaz rezervacije</th></tr>
  	
	  	<ui:repeat value="#{passengers.passengers}" var="passenger">
	  		
	  		<tr>
	  		
	  		<td><h:outputLink value="listFlightServlet?listFlight=#{passenger.JMBG}">
	  				<h:outputText value="#{passengers.passengers.indexOf(passenger)+1}"/></h:outputLink></td>
			
			<td><h:outputLink value="listFlightServlet?listFlight=#{passenger.JMBG}">
					<h:outputText value="#{passenger.ime} #{passenger.prezime}"/></h:outputLink></td>
			
			
			<td><h:outputLabel rendered="#{flight.otkazi}">
					<h:outputLink value="CancelServlet?flightId=#{flight.idLeta}"><h:outputText value="Otkazi"/></h:outputLink>
				</h:outputLabel>
				<h:outputLabel rendered="#{flight.otkazi==false}">
					<h:outputText value="Istekao rok otkaza"/>
				</h:outputLabel>
			</td>
			
			</tr>
			  
	  	</ui:repeat>
  
  	</table>
  
  	<br/>
  	
  	<h:outputLabel rendered="#{flight.slobodnaMesta}">
		<p><a href="rezervacija.faces">Rezervacija sedista</a></p>
	</h:outputLabel>
	<h:outputLabel rendered="#{flight.slobodnaMesta==false}">
		<h:outputText value="Sva mesta na ovom letu su zauzeta"/>
	</h:outputLabel>
  	
  	<p><a href="listFlightServlet?listFlight=flights">Spisak svih letova</a></p>

</f:view>

</html>